home *** CD-ROM | disk | FTP | other *** search
- Path: ohstpy.mps.ohio-state.edu!vancleef
- From: vancleef@ohstpy.mps.ohio-state.edu
- Newsgroups: comp.lang.c++
- Subject: Re: Abend caused by "strcmp"
- Message-ID: <1996Jan24.034057.8808@ohstpy>
- Date: 24 Jan 96 03:40:57 -0500
- References: <4e4guc$o1u@tst.hk.super.net>
- Organization: The Ohio State University, Department of Physics
-
- In article <4e4guc$o1u@tst.hk.super.net>, Judy Wong <jlcwong@hk.super.net> writes:
- > I am using Borland C++ v4.0 & v4.5. My machine is Intel Pentium 100.
- > The program I wrote is a window program.
- >
- > In v4.5, when my program executes the statement :
- >
- > "if (strcmp(a, NULL) == 0) ..." where a is declared as
- > char *a="name";
- >
- > it abends with the following 'Unhandled Exception' error msg. :
- >
- > General Protection Exception
- > BC450RTL(1) 0x41A7:0x61c9 Processor Fault
- >
- > I used v4.0 & test the program once again. The above msg. appeared
- > again. If the statement is changed into :
- >
- > "if (strcmp(a, "") == 0) ..."
- >
- > the program runs smoothly in either v4.0 & v4.5
- >
- > In those days before my upgrade to Pentium, I used Intel 386 & v4.0.
- > using "strcmp" comparing with NULL was OK.
- >
-
- Luck. NEVER put NULL into strcmp(). NULL is an address of 0, while
- "" is the address of a 1 byte string with a '\0' in it. "" is not 0.
-
- -Garrett
-
-
-
- > Is this hardware problem ? Or any other reasons ?
- >
- > Thanks you for you help.
- >
- > Regards,
- > Samson
- >
- >
- >
-